package com.xingkeduo.pojo.table;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author chi  2019-01-22 11:31
 **/
@Data
@Accessors(chain = true)
public abstract class BaseTable<T extends BaseTable<T>> implements Serializable {

    @TableId(value = "id", type = IdType.AUTO)
    protected long id;

    protected long code;

    //乐观锁
    @Version
    protected int version;

    @TableField(fill = FieldFill.INSERT)
    protected long createdBy;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    protected long updatedBy;

    @TableField(fill = FieldFill.INSERT)
    protected LocalDateTime createdTime = LocalDateTime.now();

    @TableField(fill = FieldFill.INSERT_UPDATE)
    protected LocalDateTime updatedTime = LocalDateTime.now();
}